function f = my_plotSigPoints(lat,lon,Sig,opt)
	% my_plotSigPoints(lat,lon,Sig,opt)
	% -------- custom function ------
	% description:
	%	plot points to show significance
	% input:
	%	lat,lon: vector, latitude and longitude
	%	Sig:	logical 2d matrix,1 = sig, 0 = not sig
	%	opt:	optional parameters
	%		opt.CoreSize:	double number. the side length of the area that
	%			echo point represents(Unit: cell number)
	%		opt.Threshold:	double number. proportion of significant grids in 
	%			the area
	%		opt.MarkerSize: double number, the size of points when plot
	% output:
	%	f: handle of figure 
	% Author: Sid Chen
	% Date: 2022/2/15
	% Log:
	%	2022/2/15 ver1.0 create
	arguments
		lat
		lon
		Sig
		opt.CoreSize = 1;
		opt.Threshold = 2/3;
		opt.MarkerSize = 1;
	end
	% get constant
	opt.Step = opt.CoreSize;
	[X,Y] = meshgrid(lon,lat);
	% get index of Significance cells
	IndexList_Sig = getIndexOfSigPoints(); 
	% get index, reduce the number of dots
	IndexList_Shrink = getIndexOfShrinkPoints();
	% get intersect of points 
	IndexList = intersect(IndexList_Sig,IndexList_Shrink);
	% plot points
	X_sig = X(IndexList);
	Y_sig = Y(IndexList);
	scatter(X_sig,Y_sig,...
		opt.MarkerSize,'o',...
		'markerfacecolor','k',...
		'markeredgecolor','k');
	
	function out = getIndexOfSigPoints()
		Core = ones(opt.CoreSize);
		Sig_conv = conv2(Sig,Core,'same');
		Threshold = sum(Core,'all') * opt.Threshold; 
		Sig_new = Sig_conv > Threshold;
		out = find(Sig_new);
	end

	function out = getIndexOfShrinkPoints()
		x_index = 1:opt.Step:size(Sig,2);
		y_index = 1:opt.Step:size(Sig,1);
		[Xindex,Yindex] = meshgrid(x_index,y_index);
		out = sub2ind(size(Sig),Yindex,Xindex);
	end
end
